/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmCadastroUsuario.java
 *
 * Created on 23/10/2009, 15:08:08
 */

package nivelacesso.telas;

import java.awt.Image;
import java.awt.Toolkit;
import java.net.URL;
import javax.swing.JOptionPane;
import nivelacesso.bd.NivelDao;
import nivelacesso.classes.Nivel;

/**
 *
 * @author Acer
 */
public class FrmCadastroNivel extends javax.swing.JFrame {


    private Nivel nivel;

    /** Creates new form FrmCadastroUsuario */
    public FrmCadastroNivel(Nivel nivel) {
        initComponents();
        URL url = this.getClass().getResource("/imagens/logo_mini.png");
        Image imagemTitulo = Toolkit.getDefaultToolkit().getImage(url);
        this.setIconImage(imagemTitulo);
        this.setLocationRelativeTo(null);
        setNivel(nivel);
        if (nivel!=null){
            popularTela(nivel);
            descricaojTextField.setText(getNivel().getDescricao());
        }
        setVisible(true);
    }

    public Nivel getNivel() {
        return nivel;
    }

    public void setNivel(Nivel nivel) {
        this.nivel = nivel;
    }




    public void popularTela(Nivel nivel){
        if (nivel.getAssociado().charAt(0)=='1'){
            associadoalterarjCheckBox.setSelected(true);
        }else associadoalterarjCheckBox.setSelected(false);
        if (nivel.getAssociado().charAt(1)=='1'){
            associadoConsultarjCheckBox.setSelected(true);
        }else associadoConsultarjCheckBox.setSelected(false);
        if (nivel.getAssociado().charAt(2)=='1'){
            associadoExcluirjCheckBox.setSelected(true);
        }else associadoExcluirjCheckBox.setSelected(false);
        if (nivel.getDependente().charAt(0)=='1'){
            depedenteAlterarjCheckBox.setSelected(true);
        }else depedenteAlterarjCheckBox.setSelected(false);
        if (nivel.getDependente().charAt(1)=='1'){
            dependenteConsultajCheckBox.setSelected(true);
        }else dependenteConsultajCheckBox.setSelected(false);
        if (nivel.getDependente().charAt(2)=='1'){
            dependenteExcluirjCheckBox.setSelected(true);
        }else dependenteExcluirjCheckBox.setSelected(false);
        if (nivel.getEntidade().charAt(0)=='1'){
            entidadeAlterarjCheckBox.setSelected(true);
        }else entidadeAlterarjCheckBox.setSelected(false);
        if (nivel.getEntidade().charAt(1)=='1'){
            entidadeConsultarjCheckBox.setSelected(true);
        }else entidadeConsultarjCheckBox.setSelected(false);
        if (nivel.getConvenio().charAt(0)=='1'){
            convenioAlterarjCheckBox.setSelected(true);
        }else convenioAlterarjCheckBox.setSelected(false);
        if (nivel.getConvenio().charAt(1)=='1'){
            convenioConsultarjCheckBox.setSelected(true);
        }else convenioAlterarjCheckBox.setSelected(false);
        if (nivel.getConvenio().charAt(2)=='1'){
            convenioExcluirjCheckBox.setSelected(true);
        }else convenioExcluirjCheckBox.setSelected(false);
        if (nivel.getCurso().charAt(0)=='1'){
            cursoAlterarjCheckBox.setSelected(true);
        }else cursoAlterarjCheckBox.setSelected(false);
        if (nivel.getCurso().charAt(1)=='1'){
            cursoConsultarjCheckBox.setSelected(true);
        }else cursoConsultarjCheckBox.setSelected(false);
        if (nivel.getCurso().charAt(2)=='1'){
            cursoExcluirjCheckBox.setSelected(true);
        }else cursoExcluirjCheckBox.setSelected(false);
        if (nivel.getProfessor().charAt(0)=='1'){
            professorAlterarjCheckBox.setSelected(true);
        }else professorAlterarjCheckBox.setSelected(false);
        if (nivel.getProfessor().charAt(1)=='1'){
            professorConsultarjCheckBox.setSelected(true);
        }else professorConsultarjCheckBox.setSelected(false);
        if (nivel.getProfessor().charAt(2)=='1'){
            professorExcluirjCheckBox.setSelected(true);
        }else professorExcluirjCheckBox.setSelected(false);
        if (nivel.getMatricula().charAt(0)=='1'){
            matriculaAlterarjCheckBox.setSelected(true);
        }else matriculaAlterarjCheckBox.setSelected(false);
        if (nivel.getMatricula().charAt(1)=='1'){
            matriculaConsultarjCheckBox.setSelected(true);
        }else matriculaConsultarjCheckBox.setSelected(false);
        if (nivel.getMatricula().charAt(2)=='1'){
            matriculaExcluirjCheckBox.setSelected(true);
        }else matriculaExcluirjCheckBox.setSelected(false);
        if (nivel.getAgenda().charAt(0)=='1'){
            agendaAlterarjCheckBox.setSelected(true);
        }else agendaAlterarjCheckBox.setSelected(false);
        if (nivel.getAgenda().charAt(1)=='1'){
            agendaConsultarjCheckBox.setSelected(true);
        }else agendaConsultarjCheckBox.setSelected(false);
        if (nivel.getAgenda().charAt(2)=='1'){
            agendaExcluirjCheckBox.setSelected(true);
        }else agendaExcluirjCheckBox.setSelected(false);
        if (nivel.getProcessos().charAt(0)=='1'){
            processoAlterarjCheckBox.setSelected(true);
        }else processoAlterarjCheckBox.setSelected(false);
        if (nivel.getProcessos().charAt(1)=='1'){
            processoConsultarjCheckBox.setSelected(true);
        }else processoConsultarjCheckBox.setSelected(false);
        if (nivel.getProcessos().charAt(2)=='1'){
            agendaAlterarjCheckBox.setSelected(true);
        }else agendaAlterarjCheckBox.setSelected(false);
        if (nivel.getProcessoControle().charAt(0)=='1'){
            controleAlterarjCheckBox.setSelected(true);
        }else controleAlterarjCheckBox.setSelected(false);
        if (nivel.getProcessoControle().charAt(1)=='1'){
            controleConsultarjCheckBox.setSelected(true);
        }else controleConsultarjCheckBox.setSelected(false);
        if (nivel.getProcessoControle().charAt(2)=='1'){
            controleExcluirjCheckBox.setSelected(true);
        }else controleExcluirjCheckBox.setSelected(false);
        if (nivel.getPlanoContas().charAt(0)=='1'){
            planocontasAlterarjCheckBox.setSelected(true);
        }else planocontasAlterarjCheckBox.setSelected(false);
        if (nivel.getPlanoContas().charAt(1)=='1'){
            planocontasConsultarjCheckBox.setSelected(true);
        }else planocontasConsultarjCheckBox.setSelected(false);
        if (nivel.getPlanoContas().charAt(2)=='1'){
            planocontasExcluirjCheckBox.setSelected(true);
        }else planocontasExcluirjCheckBox.setSelected(false);
        if (nivel.getContasPagar().charAt(0)=='1'){
            contasPagarAlterarjCheckBox.setSelected(true);
        }else contasPagarConsultarjCheckBox.setSelected(false);
        if (nivel.getContasPagar().charAt(1)=='1'){
            contasPagarConsultarjCheckBox.setSelected(true);
        }else contasPagarConsultarjCheckBox.setSelected(false);
        if (nivel.getContasPagar().charAt(2)=='1'){
            contasPagarExcluirjCheckBox.setSelected(true);
        }else contasPagarExcluirjCheckBox.setSelected(false);
        if (nivel.getContasPagar().charAt(3)=='1'){
            contasPagarLiquidarjCheckBox.setSelected(true);
        }else contasPagarLiquidarjCheckBox.setSelected(false);
        if (nivel.getContasReceber().charAt(0)=='1'){
            contasReceberAlterarjCheckBox.setSelected(true);
        }else contasReceberAlterarjCheckBox.setSelected(false);
        if (nivel.getContasReceber().charAt(1)=='1'){
            contasReceberConsultarjCheckBox.setSelected(true);
        }else contasReceberConsultarjCheckBox.setSelected(false);
        if (nivel.getContasReceber().charAt(2)=='1'){
            contasReceberExcluirjCheckBox.setSelected(true);
        }else contasReceberExcluirjCheckBox.setSelected(false);
        if (nivel.getContasReceber().charAt(3)=='1'){
            contasReceberLiquidarjCheckBox.setSelected(true);
        }else contasReceberLiquidarjCheckBox.setSelected(false);
        if (nivel.getCaixa().charAt(0)=='1'){
            movimentoCaixaAlterarjCheckBox.setSelected(true);
        }else movimentoCaixaAlterarjCheckBox.setSelected(false);
        if (nivel.getCaixa().charAt(1)=='1'){
            movimentoCaixaConsultarjCheckBox.setSelected(true);
        }else movimentoCaixaConsultarjCheckBox.setSelected(false);
        if (nivel.getCaixa().charAt(2)=='1'){
            movimentoCaixaExcluirjCheckBox.setSelected(true);
        }else movimentoCaixaExcluirjCheckBox.setSelected(false);
        if (nivel.getUsuarios().charAt(0)=='1'){
            usuarioAlterarjCheckBox.setSelected(true);
        }else usuarioAlterarjCheckBox.setSelected(false);
        if (nivel.getUsuarios().charAt(1)=='1'){
            usuarioConsultarjCheckBox.setSelected(true);
        }else usuarioConsultarjCheckBox.setSelected(false);
        if (nivel.getUsuarios().charAt(2)=='1'){
            usuarioExcluirjCheckBox.setSelected(true);
        }else usuarioExcluirjCheckBox.setSelected(false);
        if (nivel.getNivelAcesso().charAt(0)=='1'){
            nivelAcessoAlterarjCheckBox.setSelected(true);
        }else nivelAcessoAlterarjCheckBox.setSelected(false);
        if (nivel.getNivelAcesso().charAt(1)=='1'){
            nivelAcessoConsultarjCheckBox.setSelected(true);
        }else nivelAcessoConsultarjCheckBox.setSelected(false);
        if (nivel.getNivelAcesso().charAt(2)=='1'){
            nivelAcessoExcluirjCheckBox.setSelected(true);
        }else nivelAcessoExcluirjCheckBox.setSelected(false);
        if (nivel.getConfiguracao().charAt(0)=='1'){
            configuracaoAlterarjCheckBox.setSelected(true);
        }else configuracaoAlterarjCheckBox.setSelected(false);
        if (nivel.getConfiguracao().charAt(1)=='1'){
            configuracaoConsultarjCheckBox.setSelected(true);
        }else configuracaoConsultarjCheckBox.setSelected(false);
    }

    public void gerarDadosAcesso(Nivel nivel){
        String acesso=null;
        if (associadoalterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (associadoConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (associadoExcluirjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        nivel.setAssociado(acesso);

        if (depedenteAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (dependenteConsultajCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (dependenteExcluirjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        nivel.setDependente(acesso);

        if (entidadeAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (entidadeConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";

        nivel.setEntidade(acesso);

        if (convenioAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (convenioConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (convenioExcluirjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        nivel.setConvenio(acesso);

        if (cursoAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (cursoConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (cursoExcluirjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        nivel.setCurso(acesso);

        if (professorAlterarjCheckBox.isSelected()){
            acesso += "1";
        }else acesso = "0";
        if (professorConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (professorExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setProfessor(acesso);


        if (matriculaAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (matriculaConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (matriculaExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setMatricula(acesso);


        if (agendaAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (agendaConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (agendaExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setAgenda(acesso);


        if (planocontasAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (planocontasConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (planocontasExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setPlanoContas(acesso);

        if (contasPagarAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (contasPagarConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (contasPagarExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        if (contasPagarLiquidarjCheckBox.isSelected()){
            acesso+="1";
        }else acesso+="0";
        nivel.setContasPagar(acesso);


        if (contasReceberAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (contasReceberConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (contasReceberExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        if (contasReceberLiquidarjCheckBox.isSelected()){
            acesso+="1";
        }else acesso+="0";
        nivel.setContasReceber(acesso);
        
        
        if (movimentoCaixaAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (movimentoCaixaConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (movimentoCaixaExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setCaixa(acesso);


        if (usuarioAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (usuarioConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (usuarioExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setUsuarios(acesso);


        if (nivelAcessoAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (nivelAcessoConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (nivelAcessoExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setNivelAcesso(acesso);


        if (configuracaoAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (configuracaoConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        nivel.setConfiguracao(acesso);


        if (processoAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (processoConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (processoExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setProcessos(acesso);

        if (controleAlterarjCheckBox.isSelected()){
            acesso = "1";
        }else acesso = "0";
        if (controleConsultarjCheckBox.isSelected()){
            acesso+= "1";
        }else acesso+= "0";
        if (controleExcluirjCheckBox.isSelected()){
            acesso += "1";
        }else acesso += "0";
        nivel.setProcessoControle(acesso);




    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        descricaojTextField = new javax.swing.JTextField();
        niveljTabbedPane = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        associadoExcluirjCheckBox = new javax.swing.JCheckBox();
        associadoalterarjCheckBox = new javax.swing.JCheckBox();
        associadoConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel10 = new javax.swing.JPanel();
        convenioExcluirjCheckBox = new javax.swing.JCheckBox();
        convenioAlterarjCheckBox = new javax.swing.JCheckBox();
        convenioConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel11 = new javax.swing.JPanel();
        entidadeAlterarjCheckBox = new javax.swing.JCheckBox();
        entidadeConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel12 = new javax.swing.JPanel();
        dependenteExcluirjCheckBox = new javax.swing.JCheckBox();
        depedenteAlterarjCheckBox = new javax.swing.JCheckBox();
        dependenteConsultajCheckBox = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        cursoExcluirjCheckBox = new javax.swing.JCheckBox();
        cursoAlterarjCheckBox = new javax.swing.JCheckBox();
        cursoConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel14 = new javax.swing.JPanel();
        professorExcluirjCheckBox = new javax.swing.JCheckBox();
        professorAlterarjCheckBox = new javax.swing.JCheckBox();
        professorConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel16 = new javax.swing.JPanel();
        matriculaExcluirjCheckBox = new javax.swing.JCheckBox();
        matriculaAlterarjCheckBox = new javax.swing.JCheckBox();
        matriculaConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel17 = new javax.swing.JPanel();
        agendaExcluirjCheckBox = new javax.swing.JCheckBox();
        agendaAlterarjCheckBox = new javax.swing.JCheckBox();
        agendaConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel4 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        processoExcluirjCheckBox = new javax.swing.JCheckBox();
        processoAlterarjCheckBox = new javax.swing.JCheckBox();
        processoConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel18 = new javax.swing.JPanel();
        controleExcluirjCheckBox = new javax.swing.JCheckBox();
        controleAlterarjCheckBox = new javax.swing.JCheckBox();
        controleConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        contasReceberLiquidarjCheckBox = new javax.swing.JCheckBox();
        contasReceberAlterarjCheckBox = new javax.swing.JCheckBox();
        contasReceberConsultarjCheckBox = new javax.swing.JCheckBox();
        contasReceberExcluirjCheckBox = new javax.swing.JCheckBox();
        jPanel20 = new javax.swing.JPanel();
        movimentoCaixaExcluirjCheckBox = new javax.swing.JCheckBox();
        movimentoCaixaAlterarjCheckBox = new javax.swing.JCheckBox();
        movimentoCaixaConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel21 = new javax.swing.JPanel();
        contasPagarLiquidarjCheckBox = new javax.swing.JCheckBox();
        contasPagarAlterarjCheckBox = new javax.swing.JCheckBox();
        contasPagarConsultarjCheckBox = new javax.swing.JCheckBox();
        contasPagarExcluirjCheckBox = new javax.swing.JCheckBox();
        jPanel22 = new javax.swing.JPanel();
        planocontasExcluirjCheckBox = new javax.swing.JCheckBox();
        planocontasAlterarjCheckBox = new javax.swing.JCheckBox();
        planocontasConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        jPanel23 = new javax.swing.JPanel();
        usuarioExcluirjCheckBox = new javax.swing.JCheckBox();
        usuarioAlterarjCheckBox = new javax.swing.JCheckBox();
        usuarioConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel24 = new javax.swing.JPanel();
        nivelAcessoExcluirjCheckBox = new javax.swing.JCheckBox();
        nivelAcessoAlterarjCheckBox = new javax.swing.JCheckBox();
        nivelAcessoConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel25 = new javax.swing.JPanel();
        configuracaoAlterarjCheckBox = new javax.swing.JCheckBox();
        configuracaoConsultarjCheckBox = new javax.swing.JCheckBox();
        jPanel27 = new javax.swing.JPanel();
        salvarTelajButton = new javax.swing.JButton();
        fecharTelajButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Cadastro Nível de Acesso");
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setText("Descrição do Nivel");
        jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 3, -1, -1));
        jPanel1.add(descricaojTextField, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, 350, -1));

        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        jPanel2.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(167, 5, -1, -1));

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Associados"));
        jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        associadoExcluirjCheckBox.setText("Excluir");
        jPanel9.add(associadoExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        associadoalterarjCheckBox.setText("Alterar / Incluir");
        jPanel9.add(associadoalterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        associadoConsultarjCheckBox.setText("Consultar");
        jPanel9.add(associadoConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel2.add(jPanel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, 90));

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Convenio"));
        jPanel10.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        convenioExcluirjCheckBox.setText("Excluir");
        jPanel10.add(convenioExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        convenioAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel10.add(convenioAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        convenioConsultarjCheckBox.setText("Consultar");
        jPanel10.add(convenioConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel2.add(jPanel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 10, 110, 90));

        jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder("Entidade"));
        jPanel11.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        entidadeAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel11.add(entidadeAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        entidadeConsultarjCheckBox.setText("Consultar");
        jPanel11.add(entidadeConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, -1));

        jPanel2.add(jPanel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, 110, 90));

        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder("Dependetes"));
        jPanel12.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        dependenteExcluirjCheckBox.setText("Excluir");
        jPanel12.add(dependenteExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        depedenteAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel12.add(depedenteAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        dependenteConsultajCheckBox.setText("Consultar");
        jPanel12.add(dependenteConsultajCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel2.add(jPanel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 110, 90));

        niveljTabbedPane.addTab("Cadastro", jPanel2);

        jPanel3.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Cruso"));
        jPanel13.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        cursoExcluirjCheckBox.setText("Excluir");
        jPanel13.add(cursoExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        cursoAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel13.add(cursoAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        cursoConsultarjCheckBox.setText("Consultar");
        jPanel13.add(cursoConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel3.add(jPanel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, 90));

        jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Professor"));
        jPanel14.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        professorExcluirjCheckBox.setText("Excluir");
        jPanel14.add(professorExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        professorAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel14.add(professorAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        professorConsultarjCheckBox.setText("Consultar");
        jPanel14.add(professorConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel3.add(jPanel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 110, 90));

        jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Matricula"));
        jPanel16.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        matriculaExcluirjCheckBox.setText("Excluir");
        jPanel16.add(matriculaExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        matriculaAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel16.add(matriculaAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        matriculaConsultarjCheckBox.setText("Consultar");
        jPanel16.add(matriculaConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel3.add(jPanel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, 110, 90));

        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Agenda"));
        jPanel17.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        agendaExcluirjCheckBox.setText("Excluir");
        jPanel17.add(agendaExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        agendaAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel17.add(agendaAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        agendaConsultarjCheckBox.setText("Consultar");
        jPanel17.add(agendaConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel3.add(jPanel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 10, 110, 90));

        niveljTabbedPane.addTab("Cursos", jPanel3);

        jPanel4.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Processos"));
        jPanel15.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        processoExcluirjCheckBox.setText("Excluir");
        jPanel15.add(processoExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        processoAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel15.add(processoAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        processoConsultarjCheckBox.setText("Consultar");
        jPanel15.add(processoConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel4.add(jPanel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, 90));

        jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder("Controle Processos"));
        jPanel18.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        controleExcluirjCheckBox.setText("Excluir");
        jPanel18.add(controleExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        controleAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel18.add(controleAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        controleConsultarjCheckBox.setText("Consultar");
        jPanel18.add(controleConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel4.add(jPanel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 110, 90));

        niveljTabbedPane.addTab("Juridico", jPanel4);

        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder("Contas a Receber"));
        jPanel19.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        contasReceberLiquidarjCheckBox.setText("Liquidar");
        jPanel19.add(contasReceberLiquidarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1));

        contasReceberAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel19.add(contasReceberAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        contasReceberConsultarjCheckBox.setText("Consultar");
        jPanel19.add(contasReceberConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        contasReceberExcluirjCheckBox.setText("Excluir");
        jPanel19.add(contasReceberExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        jPanel5.add(jPanel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, 110, 110));

        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Movimento de Caixa"));
        jPanel20.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        movimentoCaixaExcluirjCheckBox.setText("Excluir");
        jPanel20.add(movimentoCaixaExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        movimentoCaixaAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel20.add(movimentoCaixaAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        movimentoCaixaConsultarjCheckBox.setText("Consultar");
        jPanel20.add(movimentoCaixaConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel5.add(jPanel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 10, 110, 110));

        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder("Contas a Pagar"));
        jPanel21.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        contasPagarLiquidarjCheckBox.setText("Liquidar");
        jPanel21.add(contasPagarLiquidarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, -1, -1));

        contasPagarAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel21.add(contasPagarAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        contasPagarConsultarjCheckBox.setText("Consultar");
        jPanel21.add(contasPagarConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        contasPagarExcluirjCheckBox.setText("Excluir");
        jPanel21.add(contasPagarExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        jPanel5.add(jPanel21, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 110, 110));

        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder("Plano de Contas"));
        jPanel22.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        planocontasExcluirjCheckBox.setText("Excluir");
        jPanel22.add(planocontasExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        planocontasAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel22.add(planocontasAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        planocontasConsultarjCheckBox.setText("Consultar");
        jPanel22.add(planocontasConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel5.add(jPanel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, 110));

        niveljTabbedPane.addTab("Financeiro", jPanel5);

        jPanel6.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder("Usuários"));
        jPanel23.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        usuarioExcluirjCheckBox.setText("Excluir");
        jPanel23.add(usuarioExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        usuarioAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel23.add(usuarioAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        usuarioConsultarjCheckBox.setText("Consultar");
        jPanel23.add(usuarioConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel6.add(jPanel23, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 110, 90));

        jPanel24.setBorder(javax.swing.BorderFactory.createTitledBorder("Nível de Acesso"));
        jPanel24.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        nivelAcessoExcluirjCheckBox.setText("Excluir");
        jPanel24.add(nivelAcessoExcluirjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        nivelAcessoAlterarjCheckBox.setText("Alterar / Incluir");
        jPanel24.add(nivelAcessoAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        nivelAcessoConsultarjCheckBox.setText("Consultar");
        jPanel24.add(nivelAcessoConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 40, -1, -1));

        jPanel6.add(jPanel24, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 110, 90));

        jPanel25.setBorder(javax.swing.BorderFactory.createTitledBorder("Configurações"));
        jPanel25.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        configuracaoAlterarjCheckBox.setText("Alterar");
        jPanel25.add(configuracaoAlterarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        configuracaoConsultarjCheckBox.setText("Consultar");
        jPanel25.add(configuracaoConsultarjCheckBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, -1, -1));

        jPanel6.add(jPanel25, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 10, 110, 90));

        niveljTabbedPane.addTab("Configurações", jPanel6);

        jPanel1.add(niveljTabbedPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, 470, -1));

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 480, 210));

        jPanel27.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel27.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        salvarTelajButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/tick.png"))); // NOI18N
        salvarTelajButton.setText("Salvar");
        salvarTelajButton.setToolTipText("Salvar Lançamento");
        salvarTelajButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salvarTelajButtonActionPerformed(evt);
            }
        });
        jPanel27.add(salvarTelajButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 8, -1, -1));

        fecharTelajButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/cross.png"))); // NOI18N
        fecharTelajButton.setText("Fechar");
        fecharTelajButton.setToolTipText("Fechar");
        fecharTelajButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fecharTelajButtonActionPerformed(evt);
            }
        });
        jPanel27.add(fecharTelajButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 8, -1, -1));

        getContentPane().add(jPanel27, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 220, 370, 40));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void fecharTelajButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fecharTelajButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_fecharTelajButtonActionPerformed

    private void salvarTelajButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salvarTelajButtonActionPerformed
       try{
           getNivel().setDescricao(descricaojTextField.getText());
           gerarDadosAcesso(getNivel());
           NivelDao nivelDao = new NivelDao();
           nivelDao.adcionarNivel(getNivel());
           JOptionPane.showMessageDialog(null, "Nivel salvo com sucesso");
           this.dispose();
       }catch(Exception ex){
           JOptionPane.showMessageDialog(null, "Erro salvar Daddos.\n" + ex);
       }

    }//GEN-LAST:event_salvarTelajButtonActionPerformed

    /**$$
    * @param args the command line arguments
    */
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox agendaAlterarjCheckBox;
    private javax.swing.JCheckBox agendaConsultarjCheckBox;
    private javax.swing.JCheckBox agendaExcluirjCheckBox;
    private javax.swing.JCheckBox associadoConsultarjCheckBox;
    private javax.swing.JCheckBox associadoExcluirjCheckBox;
    private javax.swing.JCheckBox associadoalterarjCheckBox;
    private javax.swing.JCheckBox configuracaoAlterarjCheckBox;
    private javax.swing.JCheckBox configuracaoConsultarjCheckBox;
    private javax.swing.JCheckBox contasPagarAlterarjCheckBox;
    private javax.swing.JCheckBox contasPagarConsultarjCheckBox;
    private javax.swing.JCheckBox contasPagarExcluirjCheckBox;
    private javax.swing.JCheckBox contasPagarLiquidarjCheckBox;
    private javax.swing.JCheckBox contasReceberAlterarjCheckBox;
    private javax.swing.JCheckBox contasReceberConsultarjCheckBox;
    private javax.swing.JCheckBox contasReceberExcluirjCheckBox;
    private javax.swing.JCheckBox contasReceberLiquidarjCheckBox;
    private javax.swing.JCheckBox controleAlterarjCheckBox;
    private javax.swing.JCheckBox controleConsultarjCheckBox;
    private javax.swing.JCheckBox controleExcluirjCheckBox;
    private javax.swing.JCheckBox convenioAlterarjCheckBox;
    private javax.swing.JCheckBox convenioConsultarjCheckBox;
    private javax.swing.JCheckBox convenioExcluirjCheckBox;
    private javax.swing.JCheckBox cursoAlterarjCheckBox;
    private javax.swing.JCheckBox cursoConsultarjCheckBox;
    private javax.swing.JCheckBox cursoExcluirjCheckBox;
    private javax.swing.JCheckBox depedenteAlterarjCheckBox;
    private javax.swing.JCheckBox dependenteConsultajCheckBox;
    private javax.swing.JCheckBox dependenteExcluirjCheckBox;
    private javax.swing.JTextField descricaojTextField;
    private javax.swing.JCheckBox entidadeAlterarjCheckBox;
    private javax.swing.JCheckBox entidadeConsultarjCheckBox;
    private javax.swing.JButton fecharTelajButton;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JCheckBox matriculaAlterarjCheckBox;
    private javax.swing.JCheckBox matriculaConsultarjCheckBox;
    private javax.swing.JCheckBox matriculaExcluirjCheckBox;
    private javax.swing.JCheckBox movimentoCaixaAlterarjCheckBox;
    private javax.swing.JCheckBox movimentoCaixaConsultarjCheckBox;
    private javax.swing.JCheckBox movimentoCaixaExcluirjCheckBox;
    private javax.swing.JCheckBox nivelAcessoAlterarjCheckBox;
    private javax.swing.JCheckBox nivelAcessoConsultarjCheckBox;
    private javax.swing.JCheckBox nivelAcessoExcluirjCheckBox;
    private javax.swing.JTabbedPane niveljTabbedPane;
    private javax.swing.JCheckBox planocontasAlterarjCheckBox;
    private javax.swing.JCheckBox planocontasConsultarjCheckBox;
    private javax.swing.JCheckBox planocontasExcluirjCheckBox;
    private javax.swing.JCheckBox processoAlterarjCheckBox;
    private javax.swing.JCheckBox processoConsultarjCheckBox;
    private javax.swing.JCheckBox processoExcluirjCheckBox;
    private javax.swing.JCheckBox professorAlterarjCheckBox;
    private javax.swing.JCheckBox professorConsultarjCheckBox;
    private javax.swing.JCheckBox professorExcluirjCheckBox;
    private javax.swing.JButton salvarTelajButton;
    private javax.swing.JCheckBox usuarioAlterarjCheckBox;
    private javax.swing.JCheckBox usuarioConsultarjCheckBox;
    private javax.swing.JCheckBox usuarioExcluirjCheckBox;
    // End of variables declaration//GEN-END:variables

}
